package com.smedi.ismedi.inmail.core.application.query.vo;

import lombok.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * @auther Cookie
 * @date 2022/8/23
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class MajorHazardPageVo {

    /**
     * 当前页
     */
    private long current;

    /**
     * 总页数
     */
    private long pages;

    /**
     * 当页行数
     */
    private long size;

    /**
     * 总记录数
     */
    private BigDecimal total;

    /**
     * 已交底数
     */
    private BigDecimal disclosureNum;

    /**
     * 未交底数
     */
    private BigDecimal notDisclosureNum;

    /**
     * 无需交底数
     */
    private BigDecimal notNeedDisclosureNum;

    /**
     * 数据
     */
    private List<MajorHazardVo> records;

    public long getPages() {
        if (this.getSize() == 0L) {
            return 0L;
        } else {
            long pages = this.getTotal().longValue() / this.getSize();
            if (this.getTotal().longValue() % this.getSize() != 0L) {
                ++pages;
            }
            return pages;
        }
    }
}
